using System.Collections;
using System.Collections.Generic;
using System.Xml.Serialization;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UIElements;

public class CannonCtrl : MonoBehaviour
{
    public float speed = 0.6f;

    public Sprite boomEffect;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }
    void FixedUpdate()
    {
        transform.position += Vector3.up * speed * Time.fixedDeltaTime;
    }

    void OnCollisionEnter2D(Collision2D collision)
    {
        var sprite_renderer = GetComponent<SpriteRenderer>();
        sprite_renderer.sprite = boomEffect;
        speed = 0;
        print(collision.gameObject.name);
        Destroy(collision.gameObject);
    }
}
